<?php
declare (strict_types=1);

namespace app\serviceapp;

use app\model\GoodsColorParam;
use app\traits\ServiceTrait;
use think\facade\Db;

/**
 * 商品颜色属性
 * Class GoodsColorParamService
 * @package app\service
 */
class GoodsColorParamService
{
    //模型，带命名空间
    public static $model = 'app\model\GoodsColorParam';
    //模型主键
    public static $pk = 'id';

    use ServiceTrait;

    /**
     * 根据colorId数据集查询goodsId
     * @param $colorIdData
     * @return array
     */
    public static function getGoodsIdByColorId($colorIdData)
    {
        $tabel = GoodsColorParam::$_table;
        $r = Db::name($tabel)->where([['color_id', 'in', $colorIdData]])->column('goods_id');
        return $r;
    }
}
